﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using FmcWebsite.Web;

namespace Cms
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void GetList(string cat_code, int max)
        {
            // get all announcements sorted by its date descendingly (newest first)
            var announcements = WebArticle.ByCategory(cat_code, this.Session)
                .OrderBy(art => -art.InsertDate.Ticks)
                .Take(max);

            Response.Write("<ul>");
            foreach (WebArticle ann in announcements)
            {
                Response.Write("<li>" + ann.GetLink() + "</li>");
                
            }
            Response.Write("</ul>");
        }
    }
}
